package com.crm.system.controller.activityManager;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.system.service.activityManager.CustomerProductActivityRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @author luojie
 * @date 2021/2/24 14:36
 */
@RestController
@RequestMapping("/customerProductActivityRelation")
@Slf4j
public class CustomerProductActivityRelationController {

    @Autowired
    private CustomerProductActivityRelationService customerProductActivityRelationService;

    /**
     * 根据活动id查询活动未选择的产品下拉框列表
     * @return
     */
    @GetMapping("/selectProductDropDownNotSelectedListByActivityId")
    public DataResponse selectProductDropDownNotSelectedListByActivityId(@RequestParam String activityId,
                                                                         @RequestParam(value="productName",required = false) String productName){
        List<HashMap> hashMapList = customerProductActivityRelationService.selectProductDropDownNotSelectedListByActivityId(activityId,productName);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),hashMapList);
    }

    /**
     * 根据活动id查询已选择产品下拉框
     * @return
     */
    @GetMapping("/selectProductDropDownSelectedListByActivityId")
    public DataResponse selectProductDropDownSelectedListByActivityId(@RequestParam String activityId){
        List<HashMap> hashMapList = customerProductActivityRelationService.selectProductDropDownSelectedListByActivityId(activityId);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),hashMapList);
    }
}
